import { Application } from 'egg';
import { Model, Document, Schema } from '.';
import { IMonitoringLog, logSchemaConfig } from './monitorLog';

export interface IApplicationMonitorErrorModel
  extends Document,
    IMonitoringLog {}
export default function monitorError(
  app: Application,
): Model<IApplicationMonitorErrorModel> {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const MonitorErrorSchema: Schema = new Schema(logSchemaConfig);
  return mongoose.model<IApplicationMonitorErrorModel>(
    'monitor_error',
    MonitorErrorSchema,
  );
}
